import * as tf from "@tensorflow/tfjs";
const input = [1, 2, 3, 4];
const w = [
  [1, 2, 3, 4],
  [2, 3, 4, 5],
  [3, 4, 5, 6],
  [4, 5, 6, 7]
];
const output = [0, 0, 0, 0];

//传统循环
for (let i = 0; i < w.length; i++) {
  console.log('')
  for (let j = 0; j < input.length; j++) {
    console.log('input[j]', input[j])
    console.log('w[i][j]', w[i][j])
    output[i] += input[j] * w[i][j]
  }
}
console.log(output)
//tensor 点乘方法
tf.tensor(w).dot(tf.tensor(input)).print();